pp108 : getRules Method

getRules Method


This method retrieves all the rules of a particular style sheet.

Syntax


styleID.getRules(sName, fpCallBack)

Parameters

Parameter

Description

sName

Required. String that specifies the name of the style sheet for which the rules are to be retrieved.

fpCallBack

Required. Pointer that specifies the function to call after getting the rules.


Return Value


No return value.

Remarks


The method first starts the style monitor, if it is not started and then retrieves the rules belonging to a particular style sheet.

The getRules() method does not return the rules directly as a return value to the function, instead it returns the data as an array to the callback function associated with it. Thus, the rules array is a parameter of the callback function, which can be used to get the information about the rules for that particular style sheet.

The array returned will contain the list of the rule names for that specified style sheet, along with the default rules defined by Process Platform Ajax Toolkit framework.

Example


The following example shows how this method is used.

<!-- style definition --> <div cordysType="wcp.library.ui.Style" id="style" > ... </div> <!-- Method invocation - Get the rules for the style sheet 'cordys' --> <input type="button" value="Get Rules" onclick="style.getRules('cordys', callBack)"> <!-- Function called --> function callBack(allRules) { var alertMessage = "All Rules : \n\n"; for (index in allRules) { alertMessage += "\t" + allRules[index] + "\n\n"; } application.notify(alertMessage); }

See Also


style